<template>
    <div>
        <h1 style="color: aquamarine;">科室列表显示</h1>
        <input type="button" value="新增科室信息" @click="add">
        <table class="table">
            <thead>
                <tr>
                    <td>编号</td>
                    <td>图片</td>
                    <td>成立时间</td>
                    <td>科室名称</td>
                </tr>
            </thead>
            <tbody>
                <tr v-for="item in data">
                    <td>{{item.id}}</td>
                    <td><img :src="'https://localhost:7187'+item.img" style="height: 120px; width: 100;"></td>
                    <td>{{item.createTime.substring(0,10)}}</td>
                    <td>{{item.officeName}}</td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import axios from 'axios';
import { onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';
const router=useRouter();

onMounted(()=>{
    GetData();
})
const cha=()=>{
    GetData();
}
const data=ref([{
    "id": 6,
    "img": "/pic/3.png",
    "createTime": "2025-02-18T00:00:00",
    "officeName": "耳科"
}])
const GetData=()=>{
    axios.get("https://localhost:7187/api/Office/GetOfficeList/GetOfficeListe",{params:data.value}).then(res=>{
        data.value=res.data;
    })
}
const add=()=>{
    router.push("/AddOffice");
}

</script>

<style scoped>

</style>